//
//  main.m
//  对象作为方法的参数
//
//  Created by 许文娟 on 2024/1/16.
//

#import <Foundation/Foundation.h>
#pragma mark 枪
/*
 
 */
/*
 士兵
 枪
 弹夹
 */
@interface Soldier : NSObject
{
    @public
    NSString *_name;
    double _height;
    double _weight;
}
-(void)fire;
@end
@implementation Soldier

-(void)fire
{
    NSLog(@"打了一枪");
}

@end
@interface Gun : NSObject
{
    @public
    NSString *_name;
    double _height;
    double _weight;
}
-(void)fire;
@end
@implementation Gun

-(void)fire
{
    NSLog(@"打了一枪");
}

@end
int main(int argc, const char * argv[]) {
//    创建士兵
    Soldier *sp =[Soldier new];
    sp->_name=@"士兵";
    sp->_height=1.88;
    sp->_weight=100.0;
//让士兵开枪
    [sp fire];
    return 0;
}
